#ifndef MLLM_OPDEFINED_H
#define MLLM_OPDEFINED_H

#include <string>
#include <vector>
using std::string;
using std::vector;

namespace mllm {
enum OpType {
    INVALID_VALUE = 0,
    PARAMETER,
    ADD,
    SOFTMAX,
    SILU,
    MATMUL,
    SCALE,
    ROPE,
    POSITIOANL_EMBEDDING,
    RMSNORM,
    CAUSALMASK,
    SLIDINGWINDOWMASK,
    LINEAR,
    LINEARINT8,
    LINEARINT8SHADOW,
    EMBEDDING,
    MUL,
    VIEW,
    KVCACHE,
    KVCACHENPU,
    RELU,
    RELU2,
    OP_GELU,
    QUICKGLUE,
    LAYERNORM,
    SPLIT,
    GATHER,
    CONVOLUTION2D,
    CONVOLUTION3D,
    VISIONROPE,
    MULTIMODALROPE,
    AVGPOOL2D,
    MAXPOOL2D,
    CAT,
    TRANSPOSE,
    SUBDIM,
    DIVISION,
    NORM,
    SHAPE,
    MEAN,
    RANGE,
    WHERE,
    REPLACE,
    PREDICTOR,
    SPARSELINEAR,
    SPARSEIDLINEAR,
    ELASTICLINEAR,
    POSITION,
    WNOP,
    QUANTIZE,
    DEQUANTIZE,
    MERGEOUTPUT,
    SPLITINPUT,
    IROPE,
    OP_NUM,
    NTKROPE,

    // add in xnnpack
    DIRECT,
    DISPATCH,
    SUBGRAPHSTART,
    SUBGRAPHFINALIZE,
    D2H,
    XP_KVCACHE,
    SDPA,

    // new front-end
    SUPERSILU,
    HEADLINEAR,

    // for speculative decoding
    ROPETREE,
    CAUSALTREEMASK,
};

static const vector<string> OpNames = {
    "INVALID_VALUE",
    "Parameter",
    "Add",
    "SoftMax",
    "SiLU",
    "MatMul",
    "MatMulINT8",
    "Scale",
    "RoPE",
    "RMSNorm",
    "CausalMask",
    "SlidingWindowMask",
    "Linear",
    "LinearINT8",
    "LinearINT8Shadow",
    "Embedding",
    "Mul",
    "VIEW",
    "KVCACHE",
    "KVCACHENPU",
    "ReLU",
    "ReLUSquaredActivation",
    "GELU",
    "QuickGELU",
    "LayerNorm",
    "Split",
    "Gqther",
    "Convolution2D",
    "Convolution3D",
    "VisonRoPE",
    "MultimodalRoPE",
    "AvgPool2D",
    "MaxPool2D",
    "Cat",
    "Transpose",
    "SubDim",
    "Division",
    "Norm",
    "Shape",
    "Mean",
    "Range",
    "Where",
    "Replace",
    "Predictor",
    "SparseLinear",
    "SparseIdLinear",
    "ElasticLinear",
    "Position",
    "WNop",
    "Quantize",
    "Dequantize",
    "MergeOutput",
    "SplitInput",
    "IRoPE",
    "OP_NUM",

    // in xnnpack
    "Direct",
    "Dispatch",
    "SubgraphStart",
    "SubgraphFinalize",
    "D2H",
    "XP_KVCACHE",
    "SDPA",
    "SuperSiLU",
    "HeadLinear",
    "RoPETree",
    "CausalTreeMask",
};

enum TensorFuncType {
    FUNC_ADD,
    FUNC_SUB,
    FUNC_MUL,
    FUNC_DIV,
    FUNC_DIVINT,
    FUNC_TTADD,
    FUNC_TTSUB,
    FUNC_TTMUL,
    FUNC_TTDIV,
    FUNC_MM,
    FUNC_NORM,
    FUNC_MEAN,
    FUNC_CAT,
    FUNC_VIEW,
    FUNC_TRANPOSE,
    FUNC_FLATTEN,
    FUNC_CLIP,
    FUNC_CLIPAXIS,
    FUNC_CLIPTENSOR,
    FUNC_RANGE,
    FUNC_WHERE,
    FUNC_INDEX_PUT,
    FUNC_SPLIT,
    FUNC_SUM,
    FUNC_TOPK,
    FUNC_EXPPAND,
    FUNC_ARGSORT,
    FUNC_BINCOUNT,
    FUNC_REPEAT,
    FUNC_LIKE,
    FUNC_SCATTERREDUCE,
    FUNC_APPLY_VISIOROPE,
    // models use only
    FUNC_FUYU_GATHER_EMBD,
    FUNC_PHI3V_HD_MERGE,
};

} // namespace mllm
#endif
